Issue Loading a SWF or JPG into a target causes
event handlers and methods attached to that target
to fail. If a target movie clip uses an
onData event, as in the
example below, loading another SWF or JPG into
that target will replace the event method, causing
the onData function to not
fire.
For example, in the following code, the
onData function will be
overwritten by the loading of foo.swf, and the
trace of "hello foo" will never happen. movieClip.attachMovie ("load_mc", "myClip", 0); loadMovie ("foo.swf", "myClip"); myClip.onData = function (){ trace ("hello foo"); }
Reason Loading files into a target timeline
replaces everything in that timeline, including
actions.
Solution One workaround is to place the event on a
physical clip on the stage using onClipEvent .
Please note, this solution is not useful for
dynamically attached movie clips.
Another possible solution, which
includes attached movie clips, involves using a
movie clip nested inside another movie clip
timeline as the target. The parent movie clip
would be attached, and the nested movie clip would
have onClipEvent already placed on
the object.
This ensures that the timeline
is not replaced when the movie or image file is
loaded into the nested movie clip.
|